home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / UTIL / SCREEN / CURSES01 / minix / c / initscr < prev    next >
Text File  |  1992-02-29  |  2KB  |  71 lines

  1. /****************************************************************/
  2. /* Initscr() routine of the PCcurses package            */
  3. /*                                */
  4. /****************************************************************/
  5. /* This version of curses is based on ncurses, a curses version    */
  6. /* originally written by Pavel Curtis at Cornell University.    */
  7. /* I have made substantial changes to make it run on IBM PC's,    */
  8. /* and therefore consider myself free to make it public domain.    */
  9. /*        Bjorn Larsson (...mcvax!enea!infovax!bl)    */
  10. /****************************************************************/
  11. /* 1.0:    Release:                    870515    */
  12. /****************************************************************/
  13. /* Modified to run under the MINIX operating system by Don Cope */
  14. /* These changes are also released into the public domain.      */
  15. /*                             900906  */
  16. /****************************************************************/
  17.  
  18. #include <curses.h>
  19. #include "curspriv.h"
  20.  
  21. WINDOW *curscr;            /* the current screen image */
  22. WINDOW *stdscr;            /* the default screen window */
  23. cursv   _cursvar;        /* curses variables */
  24. int    LINES;            /* terminal height */
  25. int    COLS;            /* terminal width */
  26.  
  27. #ifdef TERMIO
  28. #include "termio.h"
  29. struct termio   _cursoldtty;
  30. #endif
  31.  
  32. /****************************************************************/
  33. /* Initscr() does neccessary initializations for the PCcurses    */
  34. /* package. It MUST be called before any other curses routines.    */
  35. /****************************************************************/
  36.  
  37. int initscr()
  38.   {
  39.   _cursvar.cursrow   = -1;        /* Initial cursor unknown */
  40.   _cursvar.curscol   = -1;
  41.   _cursvar.autocr    = TRUE;        /* lf -> crlf by default */
  42.   _cursvar.raw       = FALSE;        /* tty I/O modes */
  43.   _cursvar.cbreak    = FALSE;
  44.   _cursvar.echo      = TRUE;
  45.   _cursvar.refrbrk   = FALSE;        /* no premature end of refresh */
  46.   _cursvar.orgcbr    = _cursesgcb();    /* original ^BREAK setting */
  47.  
  48.   _curstcap();
  49.   LINES              = _cursesglines();
  50.   COLS               = _cursesgcols();
  51.  
  52.   if ((_cursvar.tmpwin = newwin(LINES,COLS,0,0)) == (WINDOW *)ERR)
  53.     exit(1);
  54.   if ((curscr = newwin(LINES,COLS,0,0)) == (WINDOW *)ERR)
  55.     exit(1);
  56.   if ((stdscr = newwin(LINES,COLS,0,0)) == (WINDOW *)ERR)
  57.     exit(1);
  58.   curscr->_clear = FALSE;
  59. #ifdef TERMIO
  60.   ioctl(0,TCGETA,&_cursoldtty);
  61.   { struct termio t;
  62.     char buf[256],*p=buf;
  63.     t=_cursoldtty;
  64.     t.c_oflag&=~OPOST;
  65.     ioctl(0,TCSETA,&t);
  66.     tputs(tgetstr("is",&p),1,outc);
  67.   }
  68. #endif
  69.   return(OK);
  70.   } /* initscr */
  71.